# 读取文件

with open(r'D:\ui\hello\pi_digits.txt','r') as file:
    contents = file.readlines()

pi_string = ''
for content in contents:
    pi_string += content.strip()

print(pi_string[:9])
print('长度为：%s'%len(pi_string))

# 写入文件
with open(r'D:\ui\hello\programming.txt','a') as file:
    file.write('I love you.\n')
    file.write('you too.\n')

